#include "Dict.h"
#include "IVisitor.h"

Dict::Dict(const ExprTypeList& keys, const ExprTypeList& values, int nodeId):
    exprType(nodeId),
    _keys(keys),
    _values(values)
{
}
    
Dict::~Dict()
{
    _keys.clear();_values.clear();
}
    
QString Dict::type() const
{
    return "Dict";
}
    

ExprTypeList Dict::keys()
{
    return _keys;
}

void Dict::setKeys(const ExprTypeList& keys)
{
    _keys = keys;
}

ExprTypeList Dict::values()
{
    return _values;
}

void Dict::setValues(const ExprTypeList& values)
{
    _values = values;
}

    
QString Dict::toString() const
{
    return QString("Dict[keys=%1, values=%2]").
                arg(_keys.toString()).
                arg(_values.toString());
}
    
void Dict::accept(IVisitor* visitor, const SimpleNodePtr& node)
{
    visitor->visitDict(node.dynamicCast<Dict>());
}
    
void Dict::traverse(IVisitor* visitor)
{
    _keys.traverse(visitor);
    _values.traverse(visitor);
}